HVM/SVM: enable tsc scaling ratio for SVM
authorWei Huang <wei.huang2@amd.com>
Sat, 28 May 2011 07:58:08 +0000 (08:58 +0100)
committerWei Huang <wei.huang2@amd.com>
Sat, 28 May 2011 07:58:08 +0000 (08:58 +0100)
commit9405f63305fcda58fde390c38fb53db3a44963b0
tree5702eea51710ace42342749b0a25a7cb3b2039e7
parent6f1b7bcbb473e734eff8d105679a219c4c61081d
HVM/SVM: enable tsc scaling ratio for SVM

Future AMD CPUs support TSC scaling. It allows guests to have a
different TSC frequency from host system using this formula: guest_tsc
= host_tsc * tsc_ratio + vmcb_offset. The tsc_ratio is a 64bit MSR
contains a fixed-point number in 8.32 format (8 bits for integer part
and 32bits for fractional part). For instance 0x00000003_80000000
means tsc_ratio=3.5.

This patch enables TSC scaling ratio for SVM. With it, guest VMs don't
need take #VMEXIT to calculate a translated TSC value when it is
running under TSC emulation mode. This can substancially reduce the
rdtsc overhead.

Signed-off-by: Wei Huang <wei.huang2@amd.com>
xen/arch/x86/hvm/svm/svm.c
xen/arch/x86/hvm/svm/vmcb.c
xen/include/asm-x86/hvm/svm/svm.h
xen/include/asm-x86/msr-index.h